#include "IDigraph.h"
#include "tests.h"
#include <iostream>
#include <vector>

using namespace std;

void show(const vector<int>& v){
	for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
	cout << "\n";
}

int main(){
	
//	test();
	
	srand(time(NULL));
	vector<pair<int, int> > p;
	int n;
	
	n = 5;
	bool flag = false;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < i; j++){
			if (rand() % 8){
				p.push_back(make_pair(j + n * (rand() % 2), i + n * (rand() % 2)));
				if (flag) cout << " && "; else flag = true;
				cout << "(" << ((p.back().first < n) ? "" : "!") << p.back().first % n << " || " << ((p.back().second < n) ? "" : "!") << p.back().second % n << ")";
			}
		}
	}
	cout << "\n";
	Graph graph = build(n, p);
	vector<int> color = strong_component(*make_compact_digraph(graph.numberOfVertices, graph.Edges));
	vector<bool> answer = twosat(n, p);
	if (answer.size() == 0){
		cout << "this doesn't exist\n";
	} else {
		for (int i = 0; i < n; i++){
			cout << i << "-th variable is equal to " << (answer[i] ? "true" : "false") << "\n";
		}
	}

	return 0;
}